﻿<?xml version="1.0" encoding="utf-8" ?>

<DataLayout name="SR"> 
    
    <!-- ************************************************** -->
    <!-- *** System Policies and Roles                  *** -->
    <!-- ************************************************** -->

    <SystemPolicy>
      <Policy name="AutoCreateUserIfGroupMatch" type="boolean" 
              uiLocResource="Properties.Resource1.AutoCreateText"
              uiNolocResourceText="Automatically create user if group matched?" />
      <Policy name="AnonymousEnabled" type="boolean"
              uiLocResource="Properties.Resource1.AnonymousEnabledText"
              uiNolocResourceText="Anonymous Access Enabled?" />

      <!-- Basic access roles -->
      <Role name="TridentUsers" type="builtinUsers"
            uiLocResource="Properties.Resource1.UsersRoleText"
            uiNolocResourceText="Security principals that have limited user privileges" />
      <Role name="TridentAdministrators" type="builtinAdmins"
            uiLocResource="Properties.Resource1.AdminRoleText"
            uiNolocResourceText="Security principals that have admin user privileges" />            
      <Role name="TridentGuests" type="builtinGuests"
            uiLocResource="Properties.Resource1.GuestRoleText"
            uiNolocResourceText="Security principals that have guest privileges" />            
      <Role name="TridentServices" type="builtinServices"
            uiLocResource="Properties.Resource1.ServiceRoleText"
            uiNolocResourceText="Security principals that have service privileges" />            
    </SystemPolicy>

    <!-- ************************************************** -->
    <!-- *** Global Settings                            *** -->
    <!-- ************************************************** -->

    <GlobalSettings>
      <Setting name="Dataproduct" type="string"
              uiLocResource="Properties.Resource1.DataProductText"
              uiNolocResourceText="Data Product Settings" />      
    </GlobalSettings>

    <!-- ************************************************** -->

  <Objects>

    <!-- ************************************************** -->
    <!-- *** External Data Reference providers          *** -->
    <!-- ************************************************** -->

    <Object name="DataReferenceProvider" parent="NamedObject">
      <Field name="Description" type="string" /> <!-- Generic field for the getting the description of the provider. -->
      <Field name="ClassName" type="string" /> <!-- Field for the getting the Class name of the provider. -->
    </Object>

    <Object name="DataReferenceStore" parent="NamedObject">
      <Reference name="Provider" object="DataReferenceProvider" twoWay="true" />
      <Field name="Description" type="string" /> <!-- Generic field for the getting the description of the provider store. -->
      <Field name="DataProviderParameters" type="string" /> <!-- Generic field for the provider related parameters. I’m plannig to store the parameters as Serialized object. This will gve us an option for stroing Procider specific details. -->
    </Object>

    
    <!-- ************************************************** -->
    <!-- *** Service Registry                           *** -->
    <!-- ************************************************** -->

    <Object name="User" parent="NamedObject">
      <SecurityPrincipal />
      <Field name="Description" type="text" />
      <Field name="Enabled" type="boolean" />
      <Reference name="WorkflowRoot" object="Namespace" />
      <Reference name="ActivityRoot" object="Namespace" />
      <Reference name="UncategorizedWorkflows" object="Namespace" />
      <!-- No extra data for now -->
      <Enum name="EmployeeStatus" enum="EEmployeeStatus">
        <Value>Employee</Value>
        <Value>Manager</Value>
        <Value>Intern</Value>
      </Enum>
      <Field name="IsDeleted" type="boolean" />
      <Field name="IsBuiltin" type="boolean" />
    </Object>

    <Object name="Group" parent="NamedObject">
      <SecurityPrincipal />
      <Field name="Description" type="string" />
      <Field name="Enabled" type="boolean" />
      <Field name="IsDeleted" type="boolean" />
      <Field name="IsBuiltin" type="boolean" />
    </Object>

    <Object name="Namespace" parent="NamedObject">
      <Reference name="User" object="User" storeAs="Owner" twoWay="true" />
      <Reference name="Parent" object="Namespace" twoWay="true" revName="Children" />
      <Field name="Label" type="string" />
      <Field name="Description" type="text" />
      <Field name="EditorColor" type="color" />
      <Field name="Icon" type="image" />
      <Field name="IsEditable" type="boolean" />
    </Object>

    <Object name="Service" parent="NamedObject">
      <Reference name="User" object="User" storeAs="Owner" twoWay="true" />
      <Reference name="Parent" object="Namespace" twoWay="true" />
      <Field name="ClassName" type="string" />
      <Field name="Location" type="uri" />
      <Field name="Description" type="text" />
    </Object>

    <Object name="Method" parent="NamedObject">
      <Reference name="Service" object="Service" required="true" twoWay="true" />
      <Enum name="Returns" enum="RegistryDataType" storeAs="ReturnType" required="true" />
      <Enum name="CallStyle" enum="WSDL.SOAP.OperationStyle" />
      <Enum name="InputEncoding" enum="WSDL.SOAP.BodyUse" />
      <Enum name="OutputEncoding" enum="WSDL.SOAP.BodyUse" />
    </Object>

    <Object name="Artifact" parent="NamedObject">
      <Reference name="Method" object="Method" required="true" twoWay="true" />
      <Enum name="FieldType" enum="RegistryDataType" required="true" />
      <Enum name="Direction" enum="Direction" required="true" />
      <Field name="Position" type="integer" required="true" />
    </Object>

    <Object name="Tag" parent="NamedObject" >
      <Field name="Description" type="text" />
    </Object>

    <Object name="Keyword" parent="NamedObject">
      <!-- No extra data for now -->
    </Object>


    <!-- ************************************************** -->
    <!-- *** Platform                                   *** -->
    <!-- ************************************************** -->

    <Object name="Machine" parent="NamedObject">
      <Reference name="Parent" object="Machine" revName="Children" twoWay="true"/>
      <Field name="Address" type="string" />
      <Field name="Location" type="string" />
      <Field name="Description" type="string" />
      <Field name="ErrorMessage" type="string" />
      <Enum name="Availability" enum="ExecutorAvailabiltiy">
        <Value>Online</Value>
        <Value>Offline</Value>
      </Enum>
      <Enum name="Type" enum="MachineType" required="true">
        <Value>HPCCluster</Value>        
        <Value>Desktop</Value>
        <Value>HPCComputeNode</Value>
        <Value>Virtual</Value>
      </Enum>
      <Field name="IsDeleted" type="boolean" />
      <Field name="MaxConcurrentJobs" type="integer" />
      <Field name="IsInteractiveExecution" type="boolean" />
      <Field name="ComputeInstalledDirectory" type="string" />
      <Field name="ClusterUser" type="string" />
      <Field name="ClusterPassword" type="string" />
    </Object>

    <Object name="HealthCheck" parent="BasicObject">
      <Reference name="Node" object="Machine" twoWay="true" required="true" />
      <Enum name="SchedulerStatus" enum="SchedulerStatus">
        <Value>Faulty</Value>
        <Value>Running</Value>
      </Enum>
      <Enum name="ExecutorStatus" enum="MachineStatus">
        <Value>Faulty</Value>
        <Value>Running</Value>
      </Enum>
      <Field name="LastPollTime" type="dateTime" />
      <Field name="ExecutorStatusMessage" type="string" />
      <Field name="SchedulerStatusMessage" type="string" />
    </Object>
      <!-- ************************************************** -->
    <!-- *** Binary Management                          *** -->
    <!-- ************************************************** -->

    <Object name="AssemblyPackage" parent="NamedObject">
      <Field name="Label" type="string"/>
      <Field name="Description" type="text" />
      <Field name="IsDeleted" type="boolean"/>
    </Object>

    <Object name="AssemblyImage" parent="NamedObject" versioned="true">
      <Field name="Filename" type="string" />
      <Field name="FileCreateDate" type="dateTime" />
      <Field name="FileModifyDate" type="dateTime" />
      <Field name="FileExtension" type="string"/>
      <Field name="Checksum" type="string"/>
      <Field name="IsDeleted" type="boolean"/>
      <Field name="IsActivityDll" type="boolean"/>
      <Enum name="Type" enum="AssemblyType" required="true" >
        <Value>DotNET</Value>
        <Value>WindowsDLL</Value>
        <Value>DataFile</Value>
        <Value>Unknown</Value>
      </Enum>      
      <Field name="Contents" type="byteArray" />
    </Object>

    <Object name="AssemblyDeployAction" parent="BasicObject">
      <Reference name="Assembly" object="AssemblyImage" twoWay="true" revName="DeployAction" required="true" />
      <Enum enum="Action" name="DeployAction">
        <Value>None</Value>
        <Value>RegisterGAC</Value>
        <Value>CopyToFolder</Value>
        <Value>LoadIntoWorkflow</Value>
      </Enum>
      <Field name="FolderToCopy" type="string" />
    </Object>

    <!-- ************************************************** -->
    <!-- *** Workflow                                   *** -->
    <!-- ************************************************** -->

    <Object name="Activity" parent="NamedObject" versioned="true">
      <Securable>
        <!-- These are default Allow/Deny permissions. They will have 2 options that can be present or not:
            [x] Allow
            [x] Deny
        -->
        <Permission name="AuthorWorkflow" type="allowDenyRight" />                
        <Permission name="RunWorkflow" type="allowDenyRight" />
      </Securable>
      <Field name="Label" type="string" />
      <Field name="VersionLabel" type="string"/>
      <Field name="Description" type="text" />
      <!-- This one will be calculated when creating the XOML file: 
              WFName(string) -->
      <Enum name="Placement" enum="VisualPlacement">
        <Value>Horizontal</Value>
        <Value>Vertical</Value>
      </Enum>
      <Enum name="Type" enum="ActivityType" required="true">
        <Value>Leaf</Value>
        <Value>Composite</Value>
        <Value>Root</Value>
      </Enum>
      <Field name="XomlContents" type="text" />
      <Field name="ActivityClass" type="string" />
      <Field name="FullName" type="string" />
      <Field name="IsBuiltIn" type="boolean" />
      <Field name="IsDeleted" type="boolean" />
      <Field name="IsHidden" type="boolean" />
      <Field name="IsBlackbox" type="boolean" />
      <Field name="Icon" type="image" />
      <Field name="Keywords" type="string" />
      <Field name="Contacts" type="string" />
      <Field name="Comments" type="string" />
      <Field name="Author" type="string" />
      <Field name="IsInteractive" type="boolean" />
      <Field name="Source" type="string" />
      <SecurityPrincipalRef name="Owner" required="true"/>
      <Field name="DisplayLabel" type="string" />
      <Field name="IsCondition" type="boolean" />
    </Object>


    <Object name="Job" parent="NamedObject">
      <Reference name="ScheduledBy" object="User"/>
      <Field name="CompletePerc" type="integer" />
      <Enum name="Status" enum="JobStatus">
        <Value>NotStarted</Value>
        <Value>Initializing</Value>
        <Value>Running</Value>
        <Value>Paused</Value>
        <Value>Waiting</Value>
        <Value>Completed</Value>
        <Value>Aborted</Value>
        <Value>StartPending</Value>
        <Value>StopPending</Value>
        <Value>PausePending</Value>
        <Value>ResumePending</Value>
      </Enum>
      <Enum name="Priority" enum="JobPriority">
        <Value>Medium</Value>
        <Value>Low</Value>
        <Value>High</Value>
      </Enum>
      <Field name="Exclusive" type="boolean" />
      <Field name="StartTime" type="dateTime" />
      <Field name="StopTime" type="dateTime" />
      <Field name="Success" type="boolean" />
      <Field name="ErrorMessage" type="text" />
      <Field name="IsDeleted" type="boolean"/>
      <Field name="Notes" type="string"/>
      <!-- 
      IsTemplate => To check the template job.      
      -->
      <Field name="IsTemplate" type="boolean" required="true"/>
      <Field name="IsDebug" type="boolean" />
    </Object>

    <Object name="ActivityInstance" parent="BasicObject">
      <Reference name="Activity" object="Activity" twoWay="true" revName="Instance" required="true" />
      <Field name="ParameterXml" type="text" />
      <Field name="XomlContents" type="text" />
    </Object>

    <Object name="ActivityInstanceParameter" parent="BasicObject">
      <Reference name="ActivityInstance" object="ActivityInstance" twoWay="true" required="true"/>
      <Reference name="ParameterAssignment" object="ParameterAssignment" required="true"/>
      <Field name="ParamValue" type="string" required="true" />
    </Object>

    <Object name="DataProduct" parent="NamedObject" bindable="true">
      <Reference name="ProducedBy" object="ActivityInstance" twoWay="true" revName="Output" required="false" />
      <Reference name="CreatorActivity" object="ActivitySequence" twoWay="true" required="false" />
      <Reference name="CreatorParameter" object="ParameterAssignment" twoWay="true" required="false" />
      <Field name="Type" type="string" required="true" />
      <Field name="Preview" type="image" />
      <Field name="Contents" type="byteArray" />
    </Object>

    <Object name="ActivityParameter" parent="NamedObject">
      <Reference name="Activity" object="Activity" twoWay="true" required="true" />
      <Field name="Type" type="string" required="true" />
      <Field name="Label" type="string" required="false" />
      <Field name="Required" type="boolean" required="false" />
      <Enum name="Direction" enum="DirectionType" required="true" >
        <Value>Input</Value>
        <Value>Output</Value>
      </Enum>
      <Field name="Description" type="text" required="false" />
      <Field name="ParameterClass" type="string" required="false" />
      <Field name="DefaultValue" type="string" required="false" />
      <Field name="DefaultToProduct" type="boolean" required="false" />
      <Field name="IsFileReference" type="boolean" required="false" />
      <Field name="DefaultProductType" type="string" required="false" />
      <Field name="DefaultProductName" type="string" required="false" />
      <Field name="DefaultOverwrite" type="boolean" required="false" />
    </Object>
   
    <Object name="ParameterAssignment" parent="BasicObject">
      <Reference name="ActivityParameter" object="ActivityParameter" twoWay="false" required="true" />
      <Reference name="Instance" object="ActivitySequence" twoWay="true" required="true" />
      <Reference name="BoundTo" object="ParameterAssignment" twoWay="true" revName="BoundFrom" required="false"/>
      <!-- 
      BoundToPath => This identifies the actual parameter which is bound to
                      If an activity is bound to the property of a parameter then this stores the actual path.
      -->
      <Field name="BoundToPath" type="string" required="false" />
      <!-- This flag determines whether the parameter is mandatory for a particular workflow.-->
      <Field name="RequiredForWorkflow" type="boolean" required="false" />
      <Field name="CurrentValue" type="string" required="false" />

      <!--Stores the user given label with wildcards.-->
      <Field name="OutputLabel" type="string"/>

      <!--This will be used to check if the workflow output is marked as final worklfow output or intermediate output. -->
      <Field name="IsFinal" type="boolean"/>

      <!--Stores the type. (eg. Image/png)-->
      <Field name="Type" type="string"/>
    </Object>

    <Object name="ActivitySequence" parent="BasicObject">
      <Reference name="Parent" object="ActivitySequence" twoWay="true" required="true"/>
      <Reference name="Activity" object="Activity" twoWay="true" required="true"/>
      <Field name="Position" type="integer" />
      <Field name="Name" type="string" />
      <Field name="IsBase" type="boolean" />
    </Object>

    <Object name="TridentTypeInfo" parent="NamedObject">
      <Field name="TypeName" type="string" />
    </Object>

    <Object name="TypeInitializer" parent="NamedObject">
      <Reference name="RelatedType" object="TridentTypeInfo" twoWay="true" revName="Initializer" required="true" />
      <Enum name="RuntimeType" enum="Runtime" required="true" >
        <Value>WinForms</Value>
        <Value>WPF</Value>
        <Value>Silverlight</Value>
      </Enum>
      <Field name="AssemblyName" type="string" />
      <Field name="ClassName" type="string" />
      <Field name="QualifiedName" type="string" />
      <Field name="Author" type="string" />
      <Field name="IsDeleted" type="boolean"/>
    </Object>

    <Object name="JobSchedule" parent="BasicObject">
      <Field name="Name" type="string" required="true" />
      <Reference name="ScheduledBy" object="User"/>
      <Reference name="Template" object="Job" required="true" twoWay="true" revName="Schedule" />
      <Enum name="Status" enum="ScheduleStatus">
        <Value>Scheduled</Value>
        <Value>Scheduling</Value>
        <Value>Pending</Value>
        <Value>Cancelled</Value>
        <Value>UpdatePending</Value>
      </Enum>
      <Enum name="Schedule" enum="ScheduleType">
        <Value>OneTime</Value>
        <Value>Daily</Value>
        <Value>Weekly</Value>
      </Enum>
      <Field name="StartTime" type="dateTime" />
      <Field name="StopTime" type="dateTime" />
      <Field name="IsExpireEnable" type="boolean" />
      <Field name="Recurrence" type="integer" required="false" />
      <Field name="Days" type="integer" required="false" />
      <Field name="Description" type="string" />
    </Object>    
       
  
    <Object name="AdditionalParameter" parent="BasicObject">
      <Field name="Domain" type="string" required="false" />
      <Field name="ParamName" type="string" required="false" />
      <Field name="ParamValue" type="string" required="false" />
      <Reference name="Job" object="Job" twoWay="true" required="true"/>
    </Object>
     
    <!-- Start Provenance-->

    <Object name="ProvenanceInfo" parent="NamedObject">
      <Field name="JobId" type="string" />
      <Field name="ActivityName" type="string" />
      <Field name="WorkflowName" type="string" />
      <Field name="ExecutionTime" type="dateTime" />
    </Object>

    <Object name="ProvenanceDetail" parent="BasicObject">
      <Reference name="ProvenanceInfo" object="ProvenanceInfo" twoWay="true" />
      <Field name="CurrentIndex" type="string" />
      <Field name="StartEventOrder" type="integer" />
      <Field name="EndEventOrder" type="integer" />
      <Field name="IsCompleted" type="boolean" />
    </Object>

    <Object name="ProcessingStatus" parent="NamedObject">
      <Reference name="Provenance" object="ProvenanceDetail" twoWay="true" />
      <Field name="Events" type="string" />
      <Field name="EventOrder" type="integer" />
      <Field name="Details" type="string" />
      <Field name="PublishedTime" type="dateTime" />
    </Object>

    <Object name="PerformanceDetail" parent="NamedObject">
      <Reference name="Provenance" object="ProvenanceDetail" twoWay="true" />
      <Enum name="Counter" enum="PerformanceCounter">
        <Value>CPU</Value>
        <Value>Memory</Value>
      </Enum>
      <Field name="CounterValue" type="integer" />
      <Field name="PublishedTime" type="dateTime" />
    </Object>

    <Object name="PerformanceStat" parent="NamedObject">
      <Reference name="Provenance" object="ProvenanceDetail" twoWay="true" />
      <Field name="Counter" type="string" />
      <Field name="Average" type="string" />
      <Field name="Minimum" type="string" />
      <Field name="Maximum" type="string" />
    </Object>

    <Object name="InputOutput" parent="NamedObject">
      <Reference name="Provenance" object="ProvenanceDetail"  twoWay="true" />
      <Field name="PropertyName" type="string" />
      <Field name="PropertyValue" type="string" />
      <Field name="Type" type="string" required="true" />
      <Enum name="Direction" enum="DirectionType" required="true" >
        <Value>Input</Value>
        <Value>Output</Value>
      </Enum>
      <Field name="EventOrder" type="integer" />
      <Field name="PublishedTime" type="dateTime" />
    </Object>
    
    <Object name="DataProductDetail" parent="BasicObject">
      <Reference name="DataProduct" object="DataProduct" twoWay="true" required="true" />
      <Reference name="ProvenanceDetail" object="ProvenanceDetail" twoWay="true" required="true"  />
      <Field name="EventOrder" type="integer" required="false" />
    </Object>
    
    <!-- End Provenance-->

    <!-- Begin WebSite Settings-->
    <Object name="WebServiceLocation" parent="NamedObject">
      <Field name="SilverlightURI" type="string" />
      <Field name="WebServiceURI" type="string" />
    </Object>
    <!-- End WebSite Settings-->
    
  </Objects>

  <!-- ================================================================== -->

  <Relations>

    <!-- ************************************************** -->
    <!-- *** Service Registry                           *** -->
    <!-- ************************************************** -->

    <Relation one="Namespace" two="Tag" twoWay="true" />
    <Relation one="Namespace" two="Keyword" twoWay="true" />

    <Relation one="Service" two="Tag" twoWay="true" />
    <Relation one="Service" two="Keyword" twoWay="true" />

    <Relation one="Tag" two="Keyword" twoWay="true" />


    <!-- ************************************************** -->
    <!-- *** Binary Management                          *** -->
    <!-- ************************************************** -->

    <Relation one="Activity" two="AssemblyPackage" twoWay="true" />
    <Relation one="TypeInitializer" two="AssemblyPackage" twoWay="true" />
    <Relation one="AssemblyPackage" two="AssemblyImage" twoWay="true" />
    <Relation one="DataReferenceProvider" two="AssemblyPackage" twoWay="true" />
    
    <!-- ************************************************** -->
    <!-- *** Workflow                                   *** -->
    <!-- ************************************************** -->

    <Relation one="Namespace" two="Activity" twoWay="true" />
    <Relation one="Activity" two="Tag" twoWay="true" />
    <Relation one="ActivityParameter" two="Tag" twoWay="true" />
    
    <!-- ************************************************** -->
    <!-- *** Platform                                   *** -->
    <!-- ************************************************** -->
    <Relation one="Machine" two="Job" twoWay="true" />
    <Relation one="Job" two="ActivityInstance" twoWay="true" />
    <Relation one="User" two="Group" twoWay="true">
      <SecurityRelation/>
    </Relation>
    
  </Relations>

</DataLayout>
